package refunds

import (
	"jlpay-sdk-go/pkg/jlpay/core"
	"jlpay-sdk-go/pkg/jlpay/models/trans/refunds"
	"jlpay-sdk-go/pkg/jlpay/services"
)

// RefundsQueryService 退款查询服务
type RefundsQueryService struct {
	*services.BaseService
}

// NewRefundsQueryService 创建退款查询服务
func NewRefundsQueryService(config *core.Config) *RefundsQueryService {
	return &RefundsQueryService{
		BaseService: services.NewBaseService(config),
	}
}

// RefundsQuery 退款查询
func (s *RefundsQueryService) RefundsQuery(request *refunds.RefundsQueryRequest) (*refunds.RefundsQueryResponse, error) {
	response := refunds.NewRefundsQueryResponse()
	err := s.Post(request, response, "/open/trans/refunds-query")
	if err != nil {
		return nil, err
	}
	return response, nil
}
